<?php
require 'Home/Controller/Controller.php ';
require 'Home/Model/HomeModel.php';
class IndexController extends Controller{
	function __Construct(){
		parent::__Construct();
		$this->model = new HomeModel();
	}
	function index(){
        $hotList = $this->model->getHotlist();  //点击排行
        $rankList = $this->model->getRanklist();    //下载排行
        $videos = $this->model->getAllVideos();
//        var_dump($videos);
        $videotypes = $this->model->getVTypes();

//        var_dump($videos);

        $this->assign('hotList',$hotList);
        $this->assign('rankList',$rankList);
        $this->assign('videos',$videos);
        $this->assign('videotypes',$videotypes);

        $this->display();
	}

	function listPage(){ //某种类型的视频信息列表
        $tid = $_GET['tid'];

        //拿到导航栏数据
	    $list = $this->model->getVTypes();
        $this->assign('list',$list);

        //拿到内容数据，即该类所有的视频
        $content = $this->model->getOneTypeList($tid);
        $this->assign('content',$content);

        //为了拿到typename
        $type = $this->model->getTypeByID($tid);
        $this->assign('type',$type);

        //下载排行
        $rankList = $this->model->getRanklist();    //下载排行
        $this->assign('rankList',$rankList);

        $this->display();
    }

    function detail(){
        $vid = $_GET['vid'];

        //拿到导航栏数据
        $list = $this->model->getVTypes();
        $this->assign('list',$list);

        $detail = $this->model->getDetailByID($vid);
        $this->assign('detail',$detail);

        $comment = $this->model->getCommentByID($vid);
        $this->assign('comment',$comment);

        $score = $this->model->getScore($vid);
        $this->assign('score',$score);

        $this->display();

    }
}
?>